package Collestions_demo01;

import java.util.*;

public class Collectiion_Add_Test {
    public static void main(String[] args) {
        List<Snow> snow1 = Arrays.asList(new Crust(),new Power(),new Slush());
        List<Snow> snow2 = Arrays.asList(new Light(),new Heavy());
        List<Snow> snow3 = new ArrayList<>();
        Collections.addAll(snow3,new Light(),new Power());
        snow3.add(new Crust());

        List<Snow> snow4 = Arrays.<Snow>asList(new Light(),new Heavy(),new Slush());
//        snow4.add(new Power());
        Iterator it = snow1.iterator();
        while (it.hasNext()){
            System.out.println(it.next().toString());
        }
        System.out.println("++++++");
        Iterator it1 = snow2.iterator();
        while (it1.hasNext()){
            System.out.println(it1.next().toString());
        }
        System.out.println("++++++");
        Iterator it2 = snow3.iterator();
        while (it2.hasNext()){
            System.out.println(it2.next().toString());
        }
        System.out.println("++++++");
        Iterator it3 = snow4.iterator();
        while (it3.hasNext()){
            System.out.println(it3.next().toString());
        }
    }
}
class Snow{}
class Power extends Snow{}
class Light extends Power{}
class Heavy extends Snow{}
class Crust extends Snow{}
class Slush extends Snow{}
